package com.njmaomao.gj.pyot.common.exception;

import com.njmaomao.gj.pyot.common.ResponseCode;

/**
 * 本系统业务失败
 *
 * @author hh
 * 2017年4月26日
 */
public class SystemBizException extends RuntimeException {

    private static final long serialVersionUID = 450681067074732794L;

    private String code;

    private String desc;

    public SystemBizException(ResponseCode responseCode) {
        this.code = responseCode.getCode();
        this.desc = responseCode.getDesc();
    }

    public SystemBizException(String code, String desc) {
        super(code + ": " + desc);
        this.code = code;
        this.desc = desc;
    }

    public SystemBizException(String code, String desc, Object... format) {
        super(code + ": " + String.format(desc, format));
        this.code = code;
        this.desc = String.format(desc, format);
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

}
